home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Kernel.p < prev    next >
Text File  |  1996-05-01  |  29KB  |  794 lines

  1. {
  2.      File:        Kernel.p
  3.  
  4.      Contains:    Kernel Interfaces
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Kernel;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __KERNEL__}
  28. {$SETC __KERNEL__ := 1}
  29.  
  30. {$I+}
  31. {$SETC KernelIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __ERRORS__}
  35. {$I Errors.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MACHINEEXCEPTIONS__}
  38. {$I MachineExceptions.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __TIMING__}
  41. {$I Timing.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __TYPES__}
  44. {$I Types.p}
  45. {$ENDC}
  46.  
  47. {$PUSH}
  48. {$ALIGN POWER}
  49. {$LibExport+}
  50.  
  51. {$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
  52. {  Kernel basics }
  53.  
  54. TYPE
  55.     AddressSpaceID = ^LONGINT;
  56.     IOPreparationID = ^LONGINT;
  57.     SoftwareInterruptID = ^LONGINT;
  58.     TaskID = ^LONGINT;
  59.     TimerID = ^LONGINT;
  60. {  Tasking }
  61.     ExecutionLevel                        = UInt32;
  62.  
  63. CONST
  64.     kTaskLevel                    = 0;
  65.     kSoftwareInterruptLevel        = 1;
  66.     kAcceptFunctionLevel        = 2;
  67.     kKernelLevel                = 3;
  68.     kSIHAcceptFunctionLevel        = 4;
  69.     kSecondaryInterruptLevel    = 5;
  70.     kHardwareInterruptLevel        = 6;
  71.  
  72.  
  73. TYPE
  74.     SoftwareInterruptHandler = ProcPtr;  { PROCEDURE SoftwareInterruptHandler(p1: UNIV Ptr; p2: UNIV Ptr); C; }
  75.  
  76.     SecondaryInterruptHandler2 = ProcPtr;  { FUNCTION SecondaryInterruptHandler2(p1: UNIV Ptr; p2: UNIV Ptr): OSStatus; C; }
  77.  
  78. {  Memory System basics }
  79.     LogicalAddressRangePtr = ^LogicalAddressRange;
  80.     LogicalAddressRange = RECORD
  81.         address:                LogicalAddress;
  82.         count:                    ByteCount;
  83.     END;
  84.  
  85.     PhysicalAddressRangePtr = ^PhysicalAddressRange;
  86.     PhysicalAddressRange = RECORD
  87.         address:                PhysicalAddress;
  88.         count:                    ByteCount;
  89.     END;
  90.  
  91. {  For PrepareMemoryForIO and CheckpointIO }
  92.     IOPreparationOptions                = OptionBits;
  93.  
  94. CONST
  95.     kIOMultipleRanges            = $00000001;
  96.     kIOLogicalRanges            = $00000002;
  97.     kIOMinimalLogicalMapping    = $00000004;
  98.     kIOShareMappingTables        = $00000008;
  99.     kIOIsInput                    = $00000010;
  100.     kIOIsOutput                    = $00000020;
  101.     kIOCoherentDataPath            = $00000040;
  102.     kIOTransferIsLogical        = $00000080;
  103.     kIOClientIsUserMode            = $00000080;
  104.  
  105.  
  106. TYPE
  107.     IOPreparationState                    = OptionBits;
  108.  
  109. CONST
  110.     kIOStateDone                = $00000001;
  111.  
  112.     kInvalidPageAddress            = -1;
  113.  
  114.  
  115. TYPE
  116.     AddressRangePtr = ^AddressRange;
  117.     AddressRange = RECORD
  118.         base:                    Ptr;
  119.         length:                    ByteCount;
  120.     END;
  121.  
  122. {  C's treatment of arrays and array pointers is atypical }
  123.     LogicalMappingTable                    = ARRAY [0..0] OF LogicalAddress;
  124.     LogicalMappingTablePtr                = ^LogicalMappingTable;
  125.     PhysicalMappingTable                = ARRAY [0..0] OF PhysicalAddress;
  126.     PhysicalMappingTablePtr                = ^PhysicalMappingTable;
  127.     AddressRangeTable                    = ARRAY [0..0] OF AddressRange;
  128.     AddressRangeTablePtr                = ^AddressRangeTable;
  129.     MultipleAddressRangePtr = ^MultipleAddressRange;
  130.     MultipleAddressRange = RECORD
  131.         entryCount:                ItemCount;
  132.         rangeTable:                AddressRangeTablePtr;
  133.     END;
  134.  
  135. {
  136.  Separate C definition so that union has a name.  A future version of the interfacer
  137.  tool will allow a name (that gets thrown out in Pascal and Asm).
  138. }
  139.     IOPreparationTablePtr = ^IOPreparationTable;
  140.     IOPreparationTable = RECORD
  141.         options:                IOPreparationOptions;
  142.         state:                    IOPreparationState;
  143.         preparationID:            IOPreparationID;
  144.         addressSpace:            AddressSpaceID;
  145.         granularity:            ByteCount;
  146.         firstPrepared:            ByteCount;
  147.         lengthPrepared:            ByteCount;
  148.         mappingEntryCount:        ItemCount;
  149.         logicalMapping:            LogicalMappingTablePtr;
  150.         physicalMapping:        PhysicalMappingTablePtr;
  151.         CASE INTEGER OF
  152.         0: (
  153.             range:                AddressRange;
  154.             );
  155.         1: (
  156.             multipleRanges:        MultipleAddressRange;
  157.             );
  158.     END;
  159.  
  160.     IOCheckpointOptions                    = OptionBits;
  161.  
  162. CONST
  163.     kNextIOIsInput                = $00000001;
  164.     kNextIOIsOutput                = $00000002;
  165.     kMoreIOTransfers            = $00000004;
  166.  
  167. {  For SetProcessorCacheMode }
  168.  
  169. TYPE
  170.     ProcessorCacheMode                    = UInt32;
  171.  
  172. CONST
  173.     kProcessorCacheModeDefault    = 0;
  174.     kProcessorCacheModeInhibited = 1;
  175.     kProcessorCacheModeWriteThrough = 2;
  176.     kProcessorCacheModeCopyBack    = 3;
  177.  
  178. {  For GetPageInformation }
  179.     kPageInformationVersion        = 1;
  180.  
  181.  
  182. TYPE
  183.     PageStateInformation                = UInt32;
  184.  
  185. CONST
  186.     kPageIsProtected            = $00000001;
  187.     kPageIsProtectedPrivileged    = $00000002;
  188.     kPageIsModified                = $00000004;
  189.     kPageIsReferenced            = $00000008;
  190.     kPageIsLockedResident        = $00000010;
  191.     kPageIsInMemory                = $00000020;
  192.     kPageIsShared                = $00000040;
  193.     kPageIsWriteThroughCached    = $00000080;
  194.     kPageIsCopyBackCached        = $00000100;
  195.     kPageIsLocked                = $00000010;                    {  Deprecated }
  196.     kPageIsResident                = $00000020;                    {  Deprecated }
  197.  
  198.  
  199. TYPE
  200.     PageInformationPtr = ^PageInformation;
  201.     PageInformation = RECORD
  202.         area:                    AreaID;
  203.         count:                    ItemCount;
  204.         information:            ARRAY [0..0] OF PageStateInformation;
  205.     END;
  206.  
  207. {$ENDC}
  208. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  209.  
  210. TYPE
  211.     AreaReservationID = ^LONGINT;
  212.     BackingObjectID = ^LONGINT;
  213.     EventGroupID = ^LONGINT;
  214.     MessageID = ^LONGINT;
  215.     ObjectID = ^LONGINT;
  216.     PortID = ^LONGINT;
  217.     ReceiveID = ^LONGINT;
  218.     KernelProcessID = ^LONGINT;
  219.     KernelQueueID = ^LONGINT;
  220. {   System Information   }
  221.  
  222. CONST
  223.     kSystemInformationVersion    = 1;
  224.  
  225.  
  226. TYPE
  227.     SystemInformationPtr = ^SystemInformation;
  228.     SystemInformation = RECORD
  229.         numPhysicalRAMPages:    ItemCount;
  230.         numFreeRAMPages:        ItemCount;
  231.         numEligibleRAMPages:    ItemCount;
  232.         numResidentRAMPages:    ItemCount;
  233.         numInMemoryGlobalPages:    ItemCount;
  234.         numLogicalPages:        ItemCount;
  235.         pageSize:                ByteCount;
  236.         dataCacheBlockSize:        ByteCount;
  237.         processorVersionNumber:    UInt32;
  238.         numCPUs:                ItemCount;
  239.         systemKernelProcessID:    KernelProcessID;
  240.         globalAddressSpaceID:    AddressSpaceID;
  241.         dataCacheSize:            ByteCount;
  242.         instructionCacheSize:    ByteCount;
  243.         cachesAreUnified:        BOOLEAN;
  244.         filler:                    ARRAY [0..2] OF SInt8;
  245.     END;
  246.  
  247. {   KernelQueue Related Declarations   }
  248.     KernelQueueOptions                    = OptionBits;
  249. {   Event Flag Related Declarations   }
  250.     EventGroupMask                        = UInt32;
  251.  
  252. CONST
  253.     kEventFlagsPerGroup            = 32;
  254.  
  255.  
  256. TYPE
  257.     EventFlagOperation                    = UInt32;
  258.  
  259. CONST
  260.     kEventFlagAll                = 0;
  261.     kEventFlagAny                = 1;
  262.     kEventFlagAllClear            = 2;
  263.     kEventFlagAnyClear            = 3;
  264.     kEventFlagSharedClear        = 4;
  265.  
  266.  
  267. TYPE
  268.     KernelNotificationPtr = ^KernelNotification;
  269.     KernelNotification = RECORD
  270.         eventGroup:                EventGroupID;
  271.         eventMask:                EventGroupMask;
  272.         swi:                    SoftwareInterruptID;
  273.         kernelQueue:            KernelQueueID;
  274.         queueP1:                Ptr;
  275.         queueP2:                Ptr;
  276.     END;
  277.  
  278. {   Task Related Declarations   }
  279.     KernelProcessName                    = OSType;
  280.     TaskName                            = OSType;
  281.     TaskProc = ProcPtr;  { FUNCTION TaskProc(parameter: UNIV Ptr): OSStatus; C; }
  282.  
  283.     TaskStorageIndex                    = UInt32;
  284.     TaskStorageValue                    = Ptr;
  285.     TaskRelationship                    = UInt32;
  286.  
  287. CONST
  288.     kTaskOnly                    = 0;
  289.     kTaskAndChildren            = 1;
  290.     kTaskFamily                    = 2;
  291.     kTaskKernelProcess            = 3;
  292.  
  293.  
  294. TYPE
  295.     SetTaskPriorityOptions                = OptionBits;
  296.  
  297. CONST
  298.     kTaskRaisePriorityBy        = $00000200;
  299.     kTaskLowerPriorityBy        = $00000400;
  300.     kTaskRaisePriorityToAtLeast    = $00000800;
  301.     kTaskLowerPriorityToAtMost    = $00001000;
  302.  
  303.  
  304. TYPE
  305.     TaskOptions                            = OptionBits;
  306.  
  307. CONST
  308.     kTaskIsOrphan                = $00400000;
  309.     kTaskIsResident                = $00004000;
  310.  
  311. {  Priorities are used by CreateTask, SetTaskPriority, and AcceptMessage.  }
  312.  
  313. TYPE
  314.     TaskPriority                        = OptionBits;
  315.  
  316. CONST
  317.     kTaskPriorityMask            = $0000001F;
  318.     kTaskPriorityIsAbsolute        = $00000100;
  319.     kTaskPriorityIsSymbolic        = $00002000;
  320.     kTaskBackgroundPriority        = $00002001;                    {  Gets only otherwise idle time }
  321.     kTaskAppCPUBoundPriority    = $00002002;                    {  For CPU bound tasks }
  322.     kTaskAppNonUIPriority        = $00002003;                    {  For general secondary tasks }
  323.     kTaskAppPriority            = $00002004;                    {  Primary tasks }
  324.     kTaskUIHelperPriority        = $00002005;                    {  Toolbox helper tasks }
  325.     kTaskLowServerPriority        = $00002006;                    {  System servers }
  326.     kTaskServerPriority            = $00002007;                    {  System serverss }
  327.     kTaskHighServerPriority        = $00002008;                    {  System servers }
  328.     kTaskLowDriverPriority        = $00002009;                    {  IO Families & plug-ins }
  329.     kTaskDriverPriority            = $0000200A;                    {  IO Families & plug-ins }
  330.     kTaskHighDriverPriority        = $0000200B;                    {  IO Families & plug-ins }
  331.     kTaskRealTimePriority1        = $0000200C;                    {  Lowest real time priority }
  332.     kTaskRealTimePriority2        = $0000200D;
  333.     kTaskRealTimePriority3        = $0000200E;
  334.     kTaskRealTimePriority4        = $0000200F;
  335.     kTaskRealTimePriority5        = $00002010;
  336.     kTaskRealTimePriority6        = $00002011;
  337.     kTaskRealTimePriority7        = $00002012;
  338.     kTaskRealTimePriority8        = $00002013;
  339.     kTaskRealTimePriority9        = $00002014;
  340.     kTaskRealTimePriority10        = $00002015;
  341.     kTaskRealTimePriority11        = $00002016;
  342.     kTaskRealTimePriority12        = $00002017;
  343.     kTaskRealTimePriority13        = $00002018;
  344.     kTaskRealTimePriority14        = $00002019;
  345.     kTaskRealTimePriority15        = $0000201A;
  346.     kTaskRealTimePriority16        = $0000201B;                    {  Highest real time priority }
  347.  
  348.  
  349. TYPE
  350.     TerminateOptions                    = OptionBits;
  351.     SchedulerState                        = OSType;
  352.  
  353. CONST
  354.     kTaskInformationVersion        = 1;
  355.  
  356.  
  357. TYPE
  358.     TaskInformationPtr = ^TaskInformation;
  359.     TaskInformation = RECORD
  360.         name:                    TaskName;
  361.         owningKernelProcess:    KernelProcessID;
  362.         options:                TaskOptions;                            {  Includes originally specified symbolic priority }
  363.         priority:                TaskPriority;                            {  Absolute priority }
  364.         taskState:                SchedulerState;
  365.         swiState:                SchedulerState;
  366.         isTerminating:            BOOLEAN;
  367.         reserved2:                ARRAY [0..2] OF BOOLEAN;
  368.         softwareInterrupts:        ItemCount;
  369.         stackLimit:                LogicalAddress;
  370.         stackSize:                ByteCount;
  371.         creationTime:            AbsoluteTime;
  372.         cpuTime:                AbsoluteTime;
  373.         reserved:                Ptr;
  374.     END;
  375.  
  376.     KernelProcessOptions                = OptionBits;
  377.  
  378. CONST
  379.     kKernelProcessIsPrivileged    = $00000001;
  380.  
  381.     kKernelProcessInformationVersion = 1;
  382.  
  383.  
  384. TYPE
  385.     KernelProcessInformationPtr = ^KernelProcessInformation;
  386.     KernelProcessInformation = RECORD
  387.         name:                    KernelProcessName;
  388.         addressSpace:            AddressSpaceID;
  389.         options:                KernelProcessOptions;
  390.     END;
  391.  
  392. {  Timer related declarations  }
  393.     TimerOptions                        = OptionBits;
  394. {   Address Space Management related declarations   }
  395. {  General definitions }
  396.  
  397. CONST
  398.     kNoBackingObjectID            = 0;
  399.  
  400.  
  401. TYPE
  402.     AreaOptions                            = OptionBits;
  403.  
  404. CONST
  405.     kZeroFill                    = $00000001;
  406.     kResidentArea                = $00000002;
  407.     kSparseArea                    = $00000004;
  408.     kPlacedArea                    = $00000008;
  409.     kGlobalArea                    = $00000010;
  410.     kPhysicallyContiguousArea    = $00000020;
  411.     kMassMappedArea                = $00000040;
  412.  
  413.  
  414. TYPE
  415.     InterspaceCopyOptions                = OptionBits;
  416.  
  417. CONST
  418.     kCheckSourceUserRights        = $00000001;
  419.     kCheckDestinationUserRights    = $00000002;
  420.  
  421.  
  422. TYPE
  423.     AreaUsage                            = UInt32;
  424.  
  425. CONST
  426.     kUsageUnknown                = 0;
  427.     kUsageRAM                    = 1;
  428.     kUsageROM                    = 2;
  429.     kUsageIO                    = 3;
  430.     kUsageVideoRAM                = 4;
  431.  
  432.  
  433. TYPE
  434.     MemoryAccessLevel                    = UInt32;
  435.  
  436. CONST
  437.     kMemoryExcluded                = 0;
  438.     kMemoryReadOnly                = 1;
  439.     kMemoryReadWrite            = 2;
  440.     kMemoryCopyOnWrite            = 3;
  441.     kInheritUserAccess            = 4;
  442.     kInheritPrivilegedAccess    = 5;
  443.  
  444.  
  445. TYPE
  446.     BackingAddress                        = UInt64;
  447.     BackingAddressPtr                     = ^BackingAddress;
  448.     BackingLength                        = UInt64;
  449.     BackingLengthPtr                     = ^BackingLength;
  450. {     For GetSpaceInformation }
  451.  
  452. CONST
  453.     kSpaceInformationVersion    = 1;
  454.  
  455.  
  456. TYPE
  457.     SpaceInformationPtr = ^SpaceInformation;
  458.     SpaceInformation = RECORD
  459.         numLogicalPages:        ItemCount;
  460.         numInMemoryPages:        ItemCount;
  461.         numResidentPages:        ItemCount;
  462.     END;
  463.  
  464. {     For GetAreaInformation }
  465.  
  466. CONST
  467.     kAreaInformationVersion        = 1;
  468.  
  469.  
  470. TYPE
  471.     AreaInformationPtr = ^AreaInformation;
  472.     AreaInformation = RECORD
  473.         addressSpace:            AddressSpaceID;
  474.         base:                    LogicalAddress;
  475.         length:                    ByteCount;
  476.         userAccessLevel:        MemoryAccessLevel;
  477.         privilegedAccessLevel:    MemoryAccessLevel;
  478.         usage:                    AreaUsage;
  479.         backingObject:            BackingObjectID;
  480.         backingBase:            BackingAddress;
  481.         options:                AreaOptions;
  482.         owningKernelProcess:    KernelProcessID;
  483.     END;
  484.  
  485. {     For Memory Reservations }
  486.     ReservationOptions                    = OptionBits;
  487.  
  488. CONST
  489.     kPlacedReservation            = $00000001;
  490.     kGlobalReservation            = $00000002;
  491.     kGlobalAreaReservation        = $00000004;
  492.  
  493. {     For GetReservationInformation }
  494.     kReservationInformationVersion = 1;
  495.  
  496.  
  497. TYPE
  498.     ReservationInformationPtr = ^ReservationInformation;
  499.     ReservationInformation = RECORD
  500.         addressSpace:            AddressSpaceID;
  501.         base:                    LogicalAddress;
  502.         length:                    ByteCount;
  503.         options:                ReservationOptions;
  504.     END;
  505.  
  506. {     For ControlPagingForRange }
  507.     PageControlOperation                = UInt32;
  508.  
  509. CONST
  510.     kControlPageMakePageable    = 1;
  511.     kControlPageMakeResident    = 2;
  512.     kControlPageCommit            = 3;
  513.     kControlPageTouch            = 4;
  514.     kControlPageReplace            = 5;
  515.     kControlPageFlush            = 6;
  516.     kControlPageFlushAsync        = 7;
  517.  
  518. {  For ReleaseData }
  519.  
  520. TYPE
  521.     ReleaseDataOptions                    = OptionBits;
  522.  
  523. CONST
  524.     kReleaseBackingStore        = $00000001;
  525.  
  526. {   Message related declarations   }
  527.  
  528. TYPE
  529.     MessageType                            = UInt32;
  530. {  Kernel Message Types }
  531.  
  532. CONST
  533.     kAllNonKernelMessageTypes    = $0FFFFFFF;
  534.     kAllMessages                = $FFFFFFFF;
  535.  
  536. {     Options for CreatePort }
  537.  
  538. TYPE
  539.     PortOptions                            = OptionBits;
  540. {     Options for CreateObject }
  541.     ObjectOptions                        = OptionBits;
  542. {     Options for LockObject }
  543.     ObjectLockOptions                    = OptionBits;
  544.  
  545. CONST
  546.     kLockObjectWithOneMessage    = $00000001;
  547.  
  548. {     Options for SetObjectInformation; }
  549.  
  550. TYPE
  551.     SetObjectOptions                    = OptionBits;
  552.  
  553. CONST
  554.     kSetObjectPort                = $00000002;
  555.     kSetObjectRefcon            = $00000004;
  556.  
  557. {   Message System Options   }
  558.  
  559. TYPE
  560.     SendOptions                            = OptionBits;
  561.  
  562. CONST
  563.     kSendTransferKindMask        = $00000003;                    {  Set by sender }
  564.     kSendByChoice                = $00000000;
  565.     kSendByReference            = $00000001;
  566.     kSendByValue                = $00000002;
  567.     kSendIsBuffered                = $00000003;
  568.     kSendIsPrivileged            = $00000008;                    {  Set by kernel }
  569.     kSendIsAtomic                = $00000010;                    {  Set by sender }
  570.     kSendPtrsAddressable        = $00000020;                    {  Set by kernel }
  571.     kSendPtrsNeedAccessCheck    = $00000040;                    {  Set by kernel }
  572.  
  573.  
  574. TYPE
  575.     ReceiveOptions                        = OptionBits;
  576.  
  577. CONST
  578.     kReceiveNoAddressTranslation = $00000002;
  579.  
  580.  
  581. TYPE
  582.     AcceptOptions                        = OptionBits;
  583.  
  584. CONST
  585.     kAcceptFunctionIsResident    = $00010000;
  586.  
  587. {   Message Definition (Given to receiver or acceptor)   }
  588.  
  589. TYPE
  590.     MessageControlBlockPtr = ^MessageControlBlock;
  591.     MessageControlBlock = RECORD
  592.         message:                MessageID;
  593.         addressSpace:            AddressSpaceID;
  594.         sendingKernelProcess:    KernelProcessID;
  595.         sendingTask:            TaskID;
  596.         refcon:                    Ptr;
  597.         options:                SendOptions;
  598.         theType:                MessageType;
  599.         messageContents:        LogicalAddress;
  600.         messageContentsSize:    ByteCount;
  601.         replyBuffer:            LogicalAddress;
  602.         replyBufferSize:        ByteCount;
  603.         currentStatus:            OSStatus;
  604.         reserved:                ARRAY [0..3] OF UInt32;
  605.     END;
  606.  
  607.  
  608. CONST
  609.     kMessageInformationVersion    = 1;
  610.  
  611.  
  612. TYPE
  613.     MessageInformationPtr = ^MessageInformation;
  614.     MessageInformation = RECORD
  615.         object:                    ObjectID;
  616.         sendingTask:            TaskID;
  617.         sendingKernelProcess:    KernelProcessID;
  618.     END;
  619.  
  620. {   Message Accept proc used to receive a message   }
  621.     MessageAcceptProc = ProcPtr;  { FUNCTION MessageAcceptProc((CONST)VAR message: MessageControlBlock; acceptRefcon: UNIV Ptr): OSStatus; C; }
  622.  
  623. {     Version for GetPortInformation   }
  624.  
  625. CONST
  626.     kPortInformationVersion        = 1;
  627.  
  628. {   Buffer used to return message port information   }
  629.  
  630. TYPE
  631.     PortInformationPtr = ^PortInformation;
  632.     PortInformation = RECORD
  633.         owningKernelProcess:    KernelProcessID;
  634.         acceptProc:                MessageAcceptProc;
  635.         acceptHandler:            ExceptionHandler;
  636.         theAcceptOptions:        AcceptOptions;
  637.         acceptRefcon:            Ptr;
  638.         objectCount:            ItemCount;
  639.         pendingReceives:        ItemCount;
  640.         pendingSends:            ItemCount;
  641.         pendingReplies:            ItemCount;
  642.         transactionCount:        ItemCount;
  643.         blockedAsyncSenders:    ItemCount;
  644.         blockedAsyncReceivers:    ItemCount;
  645.     END;
  646.  
  647. {$ENDC}
  648. {$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
  649. {   Tasks   }
  650. FUNCTION CurrentExecutionLevel: ExecutionLevel; C;
  651. FUNCTION CurrentTaskID: TaskID; C;
  652. FUNCTION DelayFor(delayDuration: Duration): OSStatus; C;
  653. FUNCTION InPrivilegedMode: BOOLEAN; C;
  654. {   Software Interrupts   }
  655. FUNCTION CreateSoftwareInterrupt(handler: SoftwareInterruptHandler; task: TaskID; p1: UNIV Ptr; persistent: BOOLEAN; VAR theSoftwareInterrupt: SoftwareInterruptID): OSStatus; C;
  656. FUNCTION SendSoftwareInterrupt(theSoftwareInterrupt: SoftwareInterruptID; p2: UNIV Ptr): OSStatus; C;
  657. FUNCTION DeleteSoftwareInterrupt(theSoftwareInterrupt: SoftwareInterruptID): OSStatus; C;
  658. PROCEDURE DisableSoftwareInterrupts; C;
  659. PROCEDURE EnableSoftwareInterrupts; C;
  660. FUNCTION InSoftwareInterruptHandler: BOOLEAN; C;
  661. {   Completion Routines   }
  662. PROCEDURE DisableCompletionRoutines; C;
  663. PROCEDURE EnableCompletionRoutines; C;
  664. {   Secondary Interrupts   }
  665. FUNCTION CallSecondaryInterruptHandler2(theHandler: SecondaryInterruptHandler2; exceptionHandler: ExceptionHandler; p1: UNIV Ptr; p2: UNIV Ptr): OSStatus; C;
  666. FUNCTION QueueSecondaryInterruptHandler(theHandler: SecondaryInterruptHandler2; exceptionHandler: ExceptionHandler; p1: UNIV Ptr; p2: UNIV Ptr): OSStatus; C;
  667. {   Timers   }
  668. FUNCTION SetInterruptTimer({CONST}VAR expirationTime: AbsoluteTime; handler: SecondaryInterruptHandler2; p1: UNIV Ptr; VAR theTimer: TimerID): OSStatus; C;
  669. FUNCTION CancelTimer(theTimer: TimerID; VAR timeRemaining: AbsoluteTime): OSStatus; C;
  670. {   IO related Operations   }
  671. FUNCTION PrepareMemoryForIO(VAR theIOPreparationTable: IOPreparationTable): OSStatus; C;
  672. FUNCTION CheckpointIO(theIOPreparation: IOPreparationID; options: IOCheckpointOptions): OSStatus; C;
  673. {   Memory Operations   }
  674. FUNCTION GetPageInformation(addressSpace: AddressSpaceID; base: ConstLogicalAddress; requestedPages: ItemCount; version: PBVersion; VAR thePageInfo: PageInformation): OSStatus; C;
  675. {   Processor Cache Related   }
  676. FUNCTION SetProcessorCacheMode(addressSpace: AddressSpaceID; base: ConstLogicalAddress; length: ByteCount; cacheMode: ProcessorCacheMode): OSStatus; C;
  677. {$ENDC}
  678. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  679. {   Queues   }
  680. FUNCTION CreateKernelQueue(options: KernelQueueOptions; VAR theQueue: KernelQueueID): OSStatus; C;
  681. FUNCTION DeleteKernelQueue(theQueue: KernelQueueID): OSStatus; C;
  682. FUNCTION WaitOnKernelQueue(theQueue: KernelQueueID; VAR p1: UNIV Ptr; VAR p2: UNIV Ptr; VAR p3: UNIV Ptr; timeOut: Duration): OSStatus; C;
  683. FUNCTION NotifyKernelQueue(theQueue: KernelQueueID; p1: UNIV Ptr; p2: UNIV Ptr; p3: UNIV Ptr): OSStatus; C;
  684. FUNCTION AdjustKernelQueueSIHLimit(theQueue: KernelQueueID; amount: SInt32; VAR newLimit: ItemCount): OSStatus; C;
  685. {   Event Flag Related Operations   }
  686. FUNCTION CreateEventGroup(VAR theGroup: EventGroupID): OSStatus; C;
  687. FUNCTION DeleteEventGroup(theGroup: EventGroupID): OSStatus; C;
  688. FUNCTION SetEvents(theGroup: EventGroupID; mask: EventGroupMask): OSStatus; C;
  689. FUNCTION ClearEvents(theGroup: EventGroupID; mask: EventGroupMask): OSStatus; C;
  690. FUNCTION ReadEvents(theGroup: EventGroupID; VAR currentValue: EventGroupMask): OSStatus; C;
  691. FUNCTION WaitForEvents(theGroup: EventGroupID; timeOut: Duration; mask: EventGroupMask; operation: EventFlagOperation; VAR value: EventGroupMask): OSStatus; C;
  692. {   KernelProcess Related Operations   }
  693. FUNCTION CreateKernelProcess(name: KernelProcessName; addressSpace: AddressSpaceID; options: KernelProcessOptions; VAR theKernelProcess: KernelProcessID): OSStatus; C;
  694. FUNCTION ExitKernelProcess(options: TerminateOptions; exitStatus: OSStatus): OSStatus; C;
  695. FUNCTION DeleteKernelProcess(theKernelProcess: KernelProcessID; options: TerminateOptions; deleteStatus: OSStatus): OSStatus; C;
  696. FUNCTION GetKernelProcessesInSystem(requestedKernelProcesses: ItemCount; VAR totalKernelProcesses: ItemCount; VAR theKernelProcesses: KernelProcessID): OSStatus; C;
  697. FUNCTION GetKernelProcessInformation(theKernelProcess: KernelProcessID; version: PBVersion; VAR kernelProcessInfo: KernelProcessInformation): OSStatus; C;
  698. FUNCTION CurrentKernelProcessID: KernelProcessID; C;
  699. {   Task Related Operations   }
  700. FUNCTION CreateTask(name: TaskName; owningKernelProcess: KernelProcessID; entryPoint: TaskProc; parameter: UNIV Ptr; stackBase: LogicalAddress; stackSize: ByteCount; {CONST}VAR notification: KernelNotification; options: TaskOptions; VAR theTask: TaskID): OSStatus; C;
  701. FUNCTION ExitTask(options: TerminateOptions; exitStatus: OSStatus): OSStatus; C;
  702. FUNCTION TerminateTask(theTask: TaskID; scope: TaskRelationship; options: TerminateOptions; terminateStatus: OSStatus): OSStatus; C;
  703. FUNCTION RemainingStackSpace: ByteCount; C;
  704. FUNCTION GetTaskInformation(theTask: TaskID; version: PBVersion; VAR taskInfo: TaskInformation): OSStatus; C;
  705. FUNCTION SetTaskPriority(theTask: TaskID; scope: TaskRelationship; options: SetTaskPriorityOptions): OSStatus; C;
  706. FUNCTION GetTasksInKernelProcess(kernelProcess: KernelProcessID; requestedTasks: ItemCount; VAR totalTasks: ItemCount; VAR theTasks: TaskID): OSStatus; C;
  707. FUNCTION AllocateTaskStorageIndex(VAR theIndex: TaskStorageIndex): OSStatus; C;
  708. FUNCTION DeallocateTaskStorageIndex(theIndex: TaskStorageIndex): OSStatus; C;
  709. FUNCTION SetTaskStorageValue(theIndex: TaskStorageIndex; newValue: TaskStorageValue): OSStatus; C;
  710. FUNCTION GetTaskStorageValue(theIndex: TaskStorageIndex): TaskStorageValue; C;
  711. {  Secondary Interrupt Handlers  }
  712. FUNCTION AdjustSecondaryInterruptHandlerLimit(amount: SInt32; VAR newLimit: ItemCount): OSStatus; C;
  713. {   Timers   }
  714. FUNCTION DelayUntil({CONST}VAR expirationTime: AbsoluteTime): OSStatus; C;
  715. FUNCTION SetTimer({CONST}VAR expirationTime: AbsoluteTime; {CONST}VAR notification: KernelNotification; options: TimerOptions; VAR theTimer: TimerID): OSStatus; C;
  716. FUNCTION ResetTimer(theTimer: TimerID; {CONST}VAR expirationTime: AbsoluteTime; {CONST}VAR notification: KernelNotification; options: TimerOptions): OSStatus; C;
  717. FUNCTION AdjustInterruptTimerSIHLimit(amount: SInt32; VAR newLimit: ItemCount): OSStatus; C;
  718. {   Address Space Management   }
  719. FUNCTION CreateAddressSpace(VAR theAddressSpace: AddressSpaceID): OSStatus; C;
  720. FUNCTION DeleteAddressSpace(theAddressSpace: AddressSpaceID): OSStatus; C;
  721. FUNCTION GetAddressSpacesInSystem(requestedAddressSpaces: ItemCount; VAR totalAddressSpaces: ItemCount; VAR theAddressSpaces: AddressSpaceID): OSStatus; C;
  722. FUNCTION GetSpaceInformation(theAddressSpace: AddressSpaceID; version: PBVersion; VAR spaceInfo: SpaceInformation): OSStatus; C;
  723. FUNCTION InterspaceBlockCopy(sourceAddressSpace: AddressSpaceID; targetAddressSpace: AddressSpaceID; sourceBase: ConstLogicalAddress; targetBase: LogicalAddress; length: ByteCount; options: InterspaceCopyOptions): OSStatus; C;
  724. FUNCTION CheckUserAccess(address: ConstLogicalAddress; length: ByteCount; referenceKind: MemoryReferenceKind): OSStatus; C;
  725. FUNCTION CurrentAddressSpaceID: AddressSpaceID; C;
  726. {   Area Management   }
  727. FUNCTION CreateArea(owningKernelProcess: KernelProcessID; backingObject: BackingObjectID; {CONST}VAR backingBase: BackingAddress; backingLength: ByteCount; userAccessLevel: MemoryAccessLevel; privilegedAccessLevel: MemoryAccessLevel; guardLength: ByteCount; options: AreaOptions; VAR areaBase: LogicalAddress; VAR theArea: AreaID): OSStatus; C;
  728. FUNCTION CreateAreaForRange(owningKernelProcess: KernelProcessID; otherSpace: AddressSpaceID; otherBase: ConstLogicalAddress; length: ByteCount; userAccessLevel: MemoryAccessLevel; privilegedAccessLevel: MemoryAccessLevel; guardLength: ByteCount; options: AreaOptions; VAR areaBase: LogicalAddress; VAR theArea: AreaID): OSStatus; C;
  729. FUNCTION DeleteArea(theArea: AreaID): OSStatus; C;
  730. FUNCTION GetAreaInformation(theArea: AreaID; version: PBVersion; VAR areaInfo: AreaInformation): OSStatus; C;
  731. FUNCTION GetAreaFromAddress(addressSpace: AddressSpaceID; address: ConstLogicalAddress; VAR theArea: AreaID): OSStatus; C;
  732. FUNCTION GetAreasInAddressSpace(addressSpace: AddressSpaceID; requestedAreas: ItemCount; VAR totalAreas: ItemCount; VAR theAreas: AreaID): OSStatus; C;
  733. FUNCTION SetAreaAccess(theArea: AreaID; userAccessLevel: MemoryAccessLevel; privilegedAccessLevel: MemoryAccessLevel): OSStatus; C;
  734. FUNCTION SetAreaBackingBase(theArea: AreaID; {CONST}VAR backingBase: BackingAddress): OSStatus; C;
  735. FUNCTION CreateAreaReservation(owningKernelProcess: KernelProcessID; VAR reservationBase: LogicalAddress; length: ByteCount; options: ReservationOptions; VAR theReservation: AreaReservationID): OSStatus; C;
  736. FUNCTION DeleteAreaReservation(theReservation: AreaReservationID): OSStatus; C;
  737. FUNCTION GetReservationInformation(theReservation: AreaReservationID; version: PBVersion; VAR reservationInfo: ReservationInformation): OSStatus; C;
  738. FUNCTION GetReservationsInAddressSpace(addressSpace: AddressSpaceID; requestedReservations: ItemCount; VAR totalReservations: ItemCount; VAR theReservations: AreaReservationID): OSStatus; C;
  739. {   Processor Cache Related   }
  740. FUNCTION DataToCode(addressSpace: AddressSpaceID; base: ConstLogicalAddress; length: ByteCount): OSStatus; C;
  741. FUNCTION FlushRange(addressSpace: AddressSpaceID; base: ConstLogicalAddress; length: ByteCount): OSStatus; C;
  742. {   Paging control operations   }
  743. FUNCTION ControlPagingForRange(addressSpace: AddressSpaceID; base: ConstLogicalAddress; length: ByteCount; operation: PageControlOperation): OSStatus; C;
  744. FUNCTION ReleaseData(addressSpace: AddressSpaceID; base: ConstLogicalAddress; length: ByteCount; options: ReleaseDataOptions): OSStatus; C;
  745. {   Message Port Management   }
  746. FUNCTION CreatePort(options: PortOptions; VAR thePort: PortID): OSStatus; C;
  747. FUNCTION DeletePort(thePort: PortID): OSStatus; C;
  748. FUNCTION GetPortInformation(thePort: PortID; version: PBVersion; VAR portInfo: PortInformation): OSStatus; C;
  749. FUNCTION GetPortsInSystem(requestedPorts: ItemCount; VAR totalPorts: ItemCount; VAR thePorts: PortID): OSStatus; C;
  750. {   Message Object Management   }
  751. FUNCTION CreateObject(port: PortID; refcon: UNIV Ptr; options: ObjectOptions; VAR theObject: ObjectID): OSStatus; C;
  752. FUNCTION DeleteObject(theObject: ObjectID): OSStatus; C;
  753. FUNCTION LockObject(theObject: ObjectID; options: ObjectLockOptions; timeOut: Duration): OSStatus; C;
  754. FUNCTION UnlockObject(theObject: ObjectID): OSStatus; C;
  755. FUNCTION GetObjectInformation(theObject: ObjectID; VAR port: PortID; VAR refcon: UNIV Ptr): OSStatus; C;
  756. FUNCTION SetObjectInformation(theObject: ObjectID; options: SetObjectOptions; port: PortID; refcon: UNIV Ptr): OSStatus; C;
  757. FUNCTION GetObjectsInPort(port: PortID; requestedObjects: ItemCount; VAR totalObjects: ItemCount; VAR theObjects: ObjectID): OSStatus; C;
  758. {   Message Transaction Operations   }
  759. FUNCTION SendMessageSync(object: ObjectID; theType: MessageType; messageContents: ConstLogicalAddress; messageContentsSize: ByteCount; replyBuffer: LogicalAddress; VAR replyBufferSize: ByteCount; options: SendOptions; timeOut: Duration): OSStatus; C;
  760. FUNCTION SendMessageAsync(object: ObjectID; theType: MessageType; messageContents: ConstLogicalAddress; messageContentsSize: ByteCount; replyBuffer: LogicalAddress; replyBufferSize: ByteCount; options: SendOptions; {CONST}VAR notification: KernelNotification; VAR replySize: ByteCount; VAR theMessage: MessageID): OSStatus; C;
  761. FUNCTION AcceptMessage(port: PortID; theTypes: MessageType; acceptProc: MessageAcceptProc; theExceptionHandler: ExceptionHandler; options: AcceptOptions; acceptRefcon: UNIV Ptr): OSStatus; C;
  762. FUNCTION ReceiveMessageSync(port: PortID; theTypes: MessageType; VAR theControlBlock: MessageControlBlock; buffer: LogicalAddress; bufferSize: ByteCount; options: ReceiveOptions; timeOut: Duration): OSStatus; C;
  763. FUNCTION ReceiveMessageAsync(port: PortID; theTypes: MessageType; VAR theControlBlock: MessageControlBlock; buffer: LogicalAddress; bufferSize: ByteCount; options: ReceiveOptions; {CONST}VAR notification: KernelNotification; VAR theReceive: ReceiveID): OSStatus; C;
  764. FUNCTION ReplyToMessage(theMessage: MessageID; status: OSStatus; replyBuffer: ConstLogicalAddress; replyBufferSize: ByteCount): OSStatus; C;
  765. FUNCTION ReplyToMessageAndReceive(theMessage: MessageID; status: OSStatus; replyBuffer: ConstLogicalAddress; replyBufferSize: ByteCount; port: PortID; theTypes: MessageType; VAR theControlBlock: MessageControlBlock; receiveBuffer: LogicalAddress; receiveBufferSize: ByteCount; options: ReceiveOptions; timeOut: Duration): OSStatus; C;
  766. {   Miscellaneous Messaging operations   }
  767. FUNCTION CancelAsyncSend(theMessage: MessageID): OSStatus; C;
  768. FUNCTION CancelAsyncReceive(theReceive: ReceiveID): OSStatus; C;
  769. FUNCTION GetMessageInformation(theMessage: MessageID; version: PBVersion; VAR messageInfo: MessageInformation): OSStatus; C;
  770. {   Miscellaneous System operations   }
  771. FUNCTION GetSystemInformation(version: PBVersion; VAR systemInfo: SystemInformation): OSStatus; C;
  772. {     Notifications   }
  773. FUNCTION DeliverKernelNotification({CONST}VAR notification: KernelNotification; status: OSStatus): OSStatus; C;
  774. {$ENDC}
  775. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  776. {  These are defined in Memory for System 7  }
  777. PROCEDURE BlockMove(srcPtr: UNIV Ptr; destPtr: UNIV Ptr; byteCount: LONGINT);
  778. PROCEDURE BlockMoveData(srcPtr: UNIV Ptr; destPtr: UNIV Ptr; byteCount: LONGINT);
  779. PROCEDURE BlockMoveUncached(srcPtr: UNIV Ptr; destPtr: UNIV Ptr; byteCount: LONGINT); C;
  780. PROCEDURE BlockMoveDataUncached(srcPtr: UNIV Ptr; destPtr: UNIV Ptr; byteCount: LONGINT); C;
  781. PROCEDURE BlockZero(destPtr: UNIV Ptr; byteCount: LONGINT); C;
  782. PROCEDURE BlockZeroUncached(destPtr: UNIV Ptr; byteCount: LONGINT); C;
  783. {$ENDC}
  784. {$ALIGN RESET}
  785. {$POP}
  786.  
  787. {$SETC UsingIncludes := KernelIncludes}
  788.  
  789. {$ENDC} {__KERNEL__}
  790.  
  791. {$IFC NOT UsingIncludes}
  792.  END.
  793. {$ENDC}
  794.